<template>
	<view class="container">
		<view class='nav'>
<!--			<view :class='current==0?"font-color":""' class="nav_unit" id='0' v-on:click='operation'>未支付</view>-->
			<view :class='current==1?"font-color":""' class="nav_unit" id='1' v-on:click='operation'>待发货</view>
			<view :class='current==2?"font-color":""' class="nav_unit" id='2' v-on:click='operation'>已发货</view>
			<view :class='current==3?"font-color":""' class="nav_unit" id='3' v-on:click='operation'>已完成</view>
<!--			<view :class='current==4?"font-color":""' class="nav_unit" id='4' v-on:click='operation'>退换/售后</view>-->
		</view>
		<view class="content" v-show="current==0">
			<block v-if="result[0].length==0">
				<view class="none">没有订单信息</view>
			</block>
			<block v-else>
				<view class="order_unit" v-for="(value,key) in result[0]" :key="key">
					<view class="order_num">{{value[0].order_num}}</view>
					<block  v-for="(item,index) in value" :key="index">
						<view class="goods_unit" :id="value[0].order_id" v-on:click="order_detail">
							<image mode="aspectFill" :style="{height:pic_h}" :src="url+item.img_url"></image>
							<view class="goods_con">
								<view class="goods_name">{{item.goods_name}}</view>
								<view class="order_specs">{{item.order_specs_name}}</view>
								<view class="goods_property">￥{{item.order_price}}×{{item.number}}</view>
							</view>
						</view>
					</block>
					<view class="operation" v-if="value[0].is_499==1">
						<view class="price">可用{{500*value[0].number}}蓝积分兑换</view>
					</view>
					<view class="operation">
						<view class="price">
							￥{{value[0].order_money}}
							<text class="price_">（含运费：￥{{value[0].logistics}}）</text>	
						</view>
						<block v-if="value[0].order_status==0">
							<view class="delete" v-on:click="delete_submit" :id="value[0].order_id">删除订单</view>
<!--							<view class="pay g" v-on:click="pay_submit" :id="value[0].order_id">马上支付</view>-->
						</block>
					</view>
				</view>
			</block>
		</view>
		<view class="content" v-show="current==1">
			<block v-if="result[1].length==0">
				<view class="none">没有订单信息</view>
			</block>
			<block v-else>
				<view class="order_unit" v-for="(value,key) in result[1]" :key="key">
					<view class="order_num">{{value[0].order_num}}</view>
					<view class="goods_unit" v-for="(item,index) in value" :key="index" :id="value[0].order_id" v-on:click="order_detail">
						<image mode="aspectFill" :style="{height:pic_h}" :src="url+item.img_url"></image>
						<view class="goods_con">
							<view class="goods_name">{{item.goods_name}}</view>
							<view class="order_specs">{{item.order_specs_name}}</view>
							<view class="goods_property">￥{{item.order_price}}×{{item.number}}</view>
						</view>
					</view>
					<view class="operation" v-if="value[0].is_499!=1">
						<view class="price">￥{{value[0].order_money}}<text class="price_">（含运费：￥{{value[0].logistics}}）</text></view>
<!--						<view class="pay g" :id="value[0].order_id" data-status="4" v-on:click="apply_return_submit" -->
<!--						v-if="value[0].promotion!=1 || value[0].promotion_99!=1 || value[0].goods_id!=435">申请退货</view>-->
						<view class="pay s" :id="value[0].order_id" v-on:click="order_detail">查看订单</view>
					</view>
					<view class="operation" v-if="value[0].is_499==1">
						<view class="price" v-if="value[0].is_win==1">中奖<text>{{value[0].type}}</text></view>
						<view class="price" v-else>未中奖<text>{{value[0].type}}</text></view>
					</view>
					<view class="operation" v-if="value[0].is_499==1">
						<view class="price" v-if="value[0].type!='蓝积分兑换'">￥{{value[0].order_money}}<text class="price_">（含运费：￥{{value[0].logistics}}）</text></view>
						<view class="price" v-else>{{500*value[0].number}}蓝积分<text class="price_">（含运费：￥{{value[0].logistics}}）</text></view>
						<view class="pay s" :id="value[0].order_id" v-on:click="order_detail">查看订单</view>
					</view>
				</view>
			</block>
		</view>
		<view class="content" v-show="current==2">
			<block v-if="result[2].length==0">
				<view class="none">没有订单信息</view>
			</block>
			<block v-else>
				<view class="order_unit" v-for="(value,key) in result[2]" :key="key">
					<view class="order_num">{{value[0].order_num}}</view>
					<view class="goods_unit" v-for="(item,index) in value" :key="index" :id="value[0].order_id" v-on:click="order_detail">
						<image mode="aspectFill" :style="{height:pic_h}" :src="url+item.img_url"></image>
						<view class="goods_con">
							<view class="goods_name">{{item.goods_name}}</view>
							<view class="order_specs">{{item.order_specs_name}}</view>
							<view class="goods_property" v-if="item.integral_price==0">¥ {{item.order_price}}×{{item.number}}</view>
							<view class="goods_property" v-else>{{item.integral_price}}积分×1</view>
						</view>
					</view>
					<view  v-if="value[0].self_lifting_code==''">
<!--						<view class="waybill">运单号：{{value[0].waybill}}-->
<!--							<view class="copy" :data-waybill="value[0].waybill" :id="value[0].order_id" v-on:click="kuai100">查看物流信息</view>-->
<!--						</view>-->
						<view class="operation">
							<view class="price">￥{{value[0].order_money}}<text class="price_">（含运费：￥{{value[0].logistics}}）</text></view>
							<view class="success g" :id="value[0].order_id" data-status="3" v-on:click="change_status_submit">确认收货</view>
						</view>
					</view>
					<view  v-else>
<!--						<view class="waybill">运单号：{{value[0].waybill}}-->
<!--							<view class="copy" :data-waybill="value[0].waybill" :id="value[0].order_id" v-on:click="">查看物流信息</view>-->
<!--						</view>-->
						<view class="operation">
							<view class="price">自提码：<text class="price_"></text>{{value[0].self_lifting_code}}</view>
<!--							<view class="success g" :id="value[0].order_id" data-status="3" v-on:click="change_status_submit">确认收货</view>-->
						</view>
					</view>

				</view>
			</block>
		</view>
		<view class="content" v-show="current==3">
			<block v-if="result[3].length==0">
				<view class="none">没有订单信息</view>
			</block>
			<block v-else>
				<view class="order_unit" v-for="(value,key) in result[3]" :key="key">
					<view class="order_num">{{value[0].order_num}}</view>
					<view class="goods_unit" v-for="(item,index) in value" :key="index" :id="value[0].order_id" v-on:click="order_detail">
						<image mode="aspectFill" :style="{height:pic_h}" :src="url+item.img_url"></image>
						<view class="goods_con">
							<view class="goods_name">{{item.goods_name}}</view>
							<view class="order_specs">{{item.order_specs_name}}</view>
							<view class="goods_property" v-if="item.integral_price==0">¥ {{item.order_price}}×{{item.number}}</view>
							<view class="goods_property" v-else>{{item.integral_price}}积分×1</view>
						</view>
					</view>
					<view  v-if="value[0].self_lifting_code==''">
						<!-- <view class="order_num">运单号：{{value[0].waybill}}</view> -->
<!--						<view class="waybill">运单号：{{value[0].waybill}}-->
<!--							&lt;!&ndash; <view class="copy" :id="value[0].waybill" v-on:click="copy">复制</view> &ndash;&gt;-->
<!--							<view class="copy" :data-waybill="value[0].waybill" :id="value[0].order_id" v-on:click="kuai100">查看物流信息</view>-->
<!--						</view>-->
						<view class="operation">
							<view class="price">￥{{value[0].order_money}}<text class="price_">（含运费：￥{{value[0].logistics}}）</text></view>
							<!-- <view class="pay g" v-on:click="evaluate" :id="value[0].order_id" >我要评价</view> -->
						</view>
					</view>
					<view  v-else>
						<!--						<view class="waybill">运单号：{{value[0].waybill}}-->
						<!--							<view class="copy" :data-waybill="value[0].waybill" :id="value[0].order_id" v-on:click="">查看物流信息</view>-->
						<!--						</view>-->
						<view class="operation">
							<view class="price">于 - {{value[0]['success_time']}} - 提取</view>
<!--							<view class="success g" :id="value[0].order_id" data-status="3"></view>-->
						</view>
					</view>
				</view>
			</block>
			
		</view>
		<view class="content" v-show="current==4">
			<block v-if="result[4].length==0">
				<view class="none">没有订单信息</view>
			</block>
			<block v-else>
				<view class="order_unit" v-for="(value,key) in result[4]" :key="key">
					<view class="order_num">{{value[0].order_num}}</view>
					<view class="goods_unit" :style="{height:pic_h}" v-for="(item,index) in value" :key="index" :id="value[0].order_id" v-on:click="order_detail">
						<image mode="aspectFill" :style="{height:pic_h}" :src="url+item.img_url"></image>
						<view class="goods_con" :style="{height:pic_h}">
							<view class="goods_name">{{item.goods_name}}</view>
							<view class="goods_property">￥{{item.order_price}}×{{item.number}}</view>
						</view>
					</view>
					
					<view class="operation" v-if="value[0].is_499!=1">
						<view class="price">￥{{value[0].order_money}}<text class="price_">（含运费：￥{{value[0].logistics}}）</text></view>
						<view class="pay g" :id="value[0].order_id" v-on:click="order_detail">查看订单</view>
					</view>
					<view class="operation" v-if="value[0].is_499==1">
						<view class="price" v-if="value[0].is_win==1">中奖<text>{{value[0].type}}</text></view>
						<view class="price" v-else>未中奖<text>{{value[0].type}}</text></view>
					</view>
					<view class="operation" v-if="value[0].is_499==1">
						<view class="price" v-if="value[0].type!='蓝积分兑换'">￥{{value[0].order_money}}<text class="price_">（含运费：￥{{value[0].logistics}}）</text></view>
						<view class="price" v-else>{{500*value[0].number}}蓝积分<text class="price_">（含运费：￥{{value[0].logistics}}）</text></view>
						<view class="pay g" :id="value[0].order_id" v-on:click="order_detail">查看订单</view>
					</view>
				</view>
			</block>
			
		</view>
		<view class="mask" v-show="waybill_display==1" :style="{width:w,height:h}" v-on:click="close_dialog"></view>
		<view class="dialog" v-show="waybill_display==1">
			<view class="add_address">物流信息</view>
			<view class="dialog_con">
				<view class="waybill_unit" v-for="(item,index) in waybill" :key="index">
					<view class="waybill_s">
						<view class="waybill_status">【{{item.status}}】</view>
						<view class="waybill_time">{{item.time}}</view>
					</view>
					<view class="waybill_content">{{item.context}}</view>
				</view>
			</view>
		</view>
		<view class="mask" v-show="display==1" :style="{width:w,height:h}" v-on:click="close_dialog"></view>
		<view class="add" v-show="display==1">
			<view class="add_address">评价窗口</view>
			<view class='title'>
			  <view class='input_label'>评价内容</view>
				<view class="evaluate_">
					<block v-for="(item,index) in star" :key="index">
						<image :src="item.url" :data-check="item.check" :id="item.id" v-on:click="point"></image>
					</block>
				</view>
			</view>
			<view class='title'>
			  <view class='input_label'>评价内容</view>
			  <view class="input_content">
				  <textarea class='textarea' maxlength="100" placeholder='请输入评价内容,不能低于5个字' :value="text" data-name="text" @input="input_"></textarea>
				  <!-- <view class="number">{{number}}/{{total}}</view> -->
			  </view>
			</view>
			<view class='form_unit1'>
				<view class='form_label' style=''>上传商品图片</view>
				<view class='pic'>
				  <view class='pic_unit' 
				        :style='{height:width}' 
				        :id="item.order_evaluate_id" 
						:data-img='item.order_img' 
						v-if="num!=0" v-for="(item,key) in img" 
						:key='key' v-on:longpress='delete_img'>
					<image class='pic_unit_pic'  :style='{height:width}' mode="aspectFit" :src='url+item.order_img'></image>
				  </view>
					<view class='add_pic' :style='{height:width}'  v-on:click='upload_img' v-if="num!=3"><view>+</view></view>
				</view>
			</view>
			<view class="remark">
				<view class="line">长按图片，可选择删除图片</view>
			</view>
			<view class='button' :data-status="status" v-on:click='order_evaluate_submit'>发布评价</view>
		</view>
	</view>
</template>
<style>
	.waybill_unit{width:96%;padding:0 2%;line-height:60upx;border-bottom: 1px solid #F1F1F1;}
	.waybill_unit:nth-child(odd){background: #F4F4F4;}
	.waybill_s{width:100%;display: flex;justify-content: flex-start;align-items:center;height:60upx;color: #666666;font-size:26upx;}
	.waybill_status{padding-right: 20upx;}
	.waybill_content{width:100%;line-height:40upx;color: #666666;font-size:26upx;}
	/**********************/
	page{background: #F1F1F1;}
	.container{width:100%;}
	.nav{width:100%;height: 80upx;background-color:#FFFFFF; display: flex;align-items: center;justify-content: flex-start;flex-wrap: nowrap;}
	.nav_unit{width: 33.33%;height: 80upx;line-height: 80upx;  font-size: 28upx;text-align: center;}
	.font-color{color: #3de9c7;border-bottom:2px solid #3de9c7;}
	.content{width: 100%;}
	.none{width:100%;height: 80upx;line-height: 80upx;text-align: center;font-size: 28upx;}
	.order_unit{width:92%;margin:10upx 0;padding:10upx 4%;border:1px solid #F1F1F1;background:#FFFFFF;display: flex;flex-direction: column;
		justify-content: space-between;align-items: flex-start;}
	.order_num{width:100%;padding:10upx 0;font-size: 28upx;border-bottom: 1px solid #F1F1F1;}
	.goods_unit{width:100%;display: flex;justify-content: space-between;align-items:center;padding:5upx 0;border-bottom: 1px solid #F1F1F1;}
	.goods_unit image{width:20%;}
	.goods_con{width:78%;padding-left:2%;display:flex;flex-direction:column;justify-content: space-between;align-items: flex-start;}
	.goods_name{font-size: 28upx;padding-top:5upx;}
	.order_specs{font-size:26upx;color: #999999;padding:5upx 0;margin:5upx 0;}
	.goods_tag{font-size:28upx;color:#999999;}
	.goods_property{font-size: 28upx;padding-bottom: 5upx;}
	.operation{width:100%;height: 80upx;display: flex;justify-content:space-between;align-items: center;}
	.waybill{display:flex;justify-content: flex-start;align-items: center;width:80%;height: 40upx;font-size: 26upx;}
	.copy{margin-left:20upx;margin-top:5upx;padding:0upx 20upx;border-radius: 10upx;border: 1px solid #999;color: #999;}
	.price{font-size: 30upx;font-weight: bold;color: #ef3d19;}
	.price text{padding-left:20upx;font-size: 28upx;}
	.price_{font-size: 28upx;color: #999999;}
	.pay,.success{padding:10upx 20upx;margin-right: 20upx;font-size: 26upx;
	color: #FFFFFF;line-height: 40upx;border-radius: 10upx;text-align:center;}
	.delete{padding:10upx 20upx;margin-left: 40upx;font-size: 26upx;
	color: #999999;border:1px solid #F1F1F1;line-height: 40upx;border-radius: 10upx;text-align:center;}
	.g{background-image: linear-gradient(#43eac9, #24c3a4);}
	.s{border:1px solid #999;color: #999;}
	.b{background: #FF952C;}
	/************************************/
	.mask{z-index: 999;background: #000;opacity: 0.6;position: fixed;top:0;}

	.add_address{width:94%;padding:10rpx 3%;display: flex;justify-content:flex-start;align-items:center;color: #FFFFFF;
				 background-image: linear-gradient(#43eac9, #24c3a4);border-radius:10upx 10upx 0 0;}
	.title{width:94%;padding:10rpx 3%;display: flex;justify-content:space-between;background: #FFFFFF;}
	.input_label{width:25%;height:50rpx;line-height: 50rpx;font-size:26rpx;}
	.input_content{width:74.5%;display: flex;flex-direction: column;}
	.textarea{width:95.5%;border-radius: 10rpx;font-size: 24rpx;line-height: 30rpx;color: #333333;height:150rpx;border:1px solid #999999;padding: 10rpx 2%;z-index: 1;}
	
	.evaluate_{width:70%;display:flex;justify-content: flex-start;align-items: center;height: 60upx;}
	.evaluate_ image{width:45upx;height: 45upx;margin-right: 3%;}
	
	.dialog{position: fixed;top:80upx;left:5%;border-radius: 10upx;z-index: 999999;width:90%;background: #FFFFFF;}
	.dialog_con{height: 700upx;overflow-y:scroll; width:100%;}
	.add{position: fixed;bottom:0;z-index: 999999;width:100%;background: #FFFFFF;}
	.button{width:94%;margin:10rpx 3% 0 3%;left:0;background: #EF3D19;color:#ffffff;font-size: 30rpx;
	text-align: center;height:80upx;line-height: 80upx;border-radius: 10rpx;}
	/************************************/
	.form_unit1{width:96%;padding: 10upx 2%;font-size:28upx;display: flex;
				justify-content: flex-start;align-items: center;border-bottom:1px solid #F4F4F4;background: #FFFFFF;}
	.form_label{width:20%;}
	.form_con1{display: flex;justify-content: flex-start;align-items: center;}
	.photo_con{height:150upx;line-height: 150upx;width:150upx;text-align: center;font-size:45rpx;
	           font-weight: bold;  border:1rpx solid #999999; border-radius: 10rpx;color:#999999;overflow: hidden; }
	.photo_con_pic{height:150upx;width:150upx;}
	
	.pic{display: flex;justify-content:space-between;width:76%;padding:10rpx 2%;flex-wrap: wrap;}
	.add_pic{background: #CCCCCC;color: #666;font-size: 60rpx;width:31%;display: flex;align-items: center;margin:20rpx 0;text-align: center;justify-content: center;}
	
	.pic_unit{width:31%;margin:20rpx 0;}
	.pic_unit_pic{width:100%;border:1px solid #999999;}
	.remark{width:80%;padding:10upx 10%;height:60upx}
</style>
<script>
	export default {
		data() {
			return {
				current: 0,
				pic_h:'',
				result:[[],[],[],[],[]],
				start:[0,0,0,0,0],
				waybill:[],
				waybill_display:0,
				submit_status:1,
				refresh_status:0,
				status:0,
				display:0,
				w:'',
				h:'',
				width:'',
				star_num:5,
				img:[],
				img_url:'',
				order_id:'0',
				order_evaluate_id:0,
				num:0,
				text:'',
				url: getApp().globalData.url,
				static:getApp().globalData.static,
				star:[{id:1,url:"../../static/images/star.png",check:0},
						{id:2,url:"../../static/images/star.png",check:0},
						{id:3,url:"../../static/images/star.png",check:0},
						{id:4,url:"../../static/images/star.png",check:0},
						{id:5,url:"../../static/images/star.png",check:0}]
			}
		},
		onLoad(e) {
      wx.removeStorageSync("self_lifting");
			// this.width = 6*100+"px";
			var res = uni.getSystemInfoSync();
			var w = res.windowWidth;
			this.pic_h = w*0.92*0.2+"px";
			if(e.status!=undefined)
			{
				this.current = parseInt(e.status);
			}
			
			this.initialize(this.current);
			this.w = w+"px";
			this.h = res.windowHeight+"px";
			
			this.width  = res.windowWidth * 70 / 100 * 31 / 100+"px";
		},
		onPullDownRefresh() {
			this.refresh_status = 1;
			this.initialize(this.current);
		},
		onReachBottom:function()
		{
			this.initialize(this.current);
		},
		methods: {
			apply_return_submit:function(e)
			{
				var order_id = e.currentTarget.id;
				var that = this;
				uni.showModal({
					title:"操作提示",
					content:"点击确认按钮，可申请退货",
					success: (res) => {
						if(res.confirm)
						{
							uni.request({
								url: this.url+'/wechat_refund_apply', 
								data: {order_id:order_id},
								header: {'Content-Type': 'application/json'},
								success: (result) => {
									if(result.data.status==1)
									{
										uni.showToast({
											title:"申请成功",
											duration:1500
										})
									}
									else
									{
										uni.showModal({
											title:"操作提示",
											content:result.data.msg,
											showCancel:false
										})
									}
								}
							});
						}
					}
				})
			},
			kuai100:function(e)
			{
				var order_id = e.currentTarget.id;
				var that = this;
				uni.request({
					url: this.url+'/wechat_express_info', 
					data: {order_id:order_id},
					header: {'Content-Type': 'application/json'},
					success: (res) => {
						console.log(res.data.data);
						if(res.data.message=="ok")
						{
							that.waybill_display = 1;
							that.waybill = res.data.data;
						}
						else
						{
							uni.showToast({
								title:"没有物流信息",
								duration:1500
							})
						}
					}
				});
			},
			copy:function(e)
			{
				var data = e.currentTarget.id;
				uni.setClipboardData({data:data});
			},
			order_detail:function(e)
			{
				var id = e.currentTarget.id;
				console.log(id);
				uni.navigateTo({
					url:"../mall/order_detail?order_id="+id
				})
			},
			order_evaluate_submit:function()
			{
				var member_id = uni.getStorageSync("member_id");
				var that = this;
				if(that.text.length>5)
				{
					uni.request({
						url: this.url+'/wechat_update_order_evaluate', 
						data: {order_evaluate_id:that.order_evaluate_id,order_id:that.order_id,member_id:member_id,text:that.text,number:that.star_num},
						header: {'Content-Type': 'application/json'},
						success: (re) => {
							if(re.data.status==1)
							{
								that.display = 0;
								that.text    = '';
								that.order_evaluate_id = 0;
								that.star_num = 5;
								uni.showToast({
									title:'评价成功！',
									duration:2000
								})
							}
						}
					});
				}
				else
				{
					uni.showToast({
						title:'内容不能为空',
						duration:2000
					})
				}
			},
			delete_img:function(e)
			{
				var order_id = e.currentTarget.id;
				var img = e.currentTarget.dataset.img;
				var that = this;
				uni.showModal({
					title:'操作提示',
					content:"确认要删除该图片？",
					success:function(res)
					{
						if(res.confirm)
						{
							uni.request({
								url: that.url+'/wechat_delete_order_evaluate_img', 
								data: {order_evaluate_id:order_id,img:img},
								header: {'Content-Type': 'application/json'},
								success: (re) => {
									if(re.data.status==1)
									{
										for(var i=0;i<that.img.length;i++)
										{
											if(that.img[i].order_img==img)
											{
												that.img.splice(i,1);
												that.num--;
											}
										}
										uni.showToast({
											title:"操作成功",
											duration:2000
										})
									}
								}
							});
						}
					}
				})
				
			},
			upload_img:function()
			{
				var that = this;
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album','camera'], //从相册选择
					success: function (res) {
						// console.log(JSON.stringify(res.tempFilePaths[0]));
						that.img_url = res.tempFilePaths[0];
						// that.img.push(tmp);
						that.upload_file();
					}
				});
			},
			upload_file:function()
			{
				var member_id = uni.getStorageSync("member_id");
				var that = this;
				uni.showLoading({
					title:"上传中...",
					mask:true,
					success:(res)=>{
						uni.uploadFile({
							url:that.url+'/wechat_upload_img', 
							filePath:that.img_url,
							name:'file',
							formData:{'name':'evaluate_img',order_id:that.order_id,member_id:member_id},
							success:(res)=>{
								var result = JSON.parse(res.data);
								that.img = [];
								that.num = 0;
								for(var i=0;i<result.result.length;i++)
								{
									if(result.result[i].img!='0')
									{
										var tmp = {};
										tmp.order_evaluate_id = result.result[i].order_evaluate_id;
										tmp.order_id          = result.result[i].order_id;
										tmp.order_img         = result.result[i].img;
										that.img.push(tmp);
										that.order_evaluate_id = result.result[i].order_evaluate_id;
										that.num++;
									}
									
								}
								
								uni.hideLoading();
							}
						})
					}
				})
			},
			evaluate:function(e)
			{
				
				var that = this;
				this.order_id = e.currentTarget.id;
				var member_id = uni.getStorageSync("member_id");
				uni.request({
					url: that.url+'/wechat_get_evaluate', 
					data: {member_id:member_id,order_id:this.order_id},
					header: {'Content-Type': 'application/json'},
					success: (res) => {
						console.log(res);
						if(res.data.status==1)
						{
							uni.showToast({
								title:"已经评价过了",
								duration:2000
							})
						}
						else
						{
							that.display = 1;
						}
					}
				});
			},			
			close_dialog:function()
			{
				this.display = 0;
				this.waybill_display = 0;
			},
			point:function(e)
			{
				var check = e.currentTarget.dataset.check;
				var id    = e.currentTarget.id;
				this.star_num = parseInt(id);
				for(var i=0;i<this.star_num;i++)
				{
					this.star[i].url = "../../static/images/star.png";
				}
				for(var i=this.star_num;i<5;i++)
				{
					this.star[i].url = "../../static/images/empty_.png";
				}
			},
			input_:function(e)
			{
				if(e.currentTarget.dataset.name=="text")
				{
					// this.number = e.detail.cursor;
					this.text   = e.detail.value;
				}
			},
			change_status_submit:function(e)
			{
				// console.log(e.currentTarget);return;
				var id     = e.currentTarget.id;
				var status = e.currentTarget.dataset.status;
				var that = this;
				uni.showModal({
					title:"确认收货",
					content:"点击确认收货",
					success: (res) => {
						if(res.confirm)
						{
							uni.request({
								url: that.url+'/wechat_update_goods_order_status', 
								data: {status:status,id:id},
								header: {'Content-Type': 'application/json'},
								success: (res) => {
									if(res.data.status==1)
									{
										var tmp = [];
										for(var k=0;k<that.result[that.current].length;k++)
										{
											for(var j=0;j<that.result[that.current][k].length;j++)
											{
												if(parseInt(id)==that.result[that.current][k][j].order_id)
												{
													that.result[that.current][k][j].order_status =3;
													tmp  = that.result[that.current][k];
													that.result[that.current][k].splice(k,1);
												}
											}
										}
										that.result[3].push(tmp);
										uni.showToast({
											title:"操作成功！",
											duration:3000})
									}
								}
							});
						}
					}
				})
			},
			pay_submit:function(e)
			{
				var id = e.currentTarget.id;
				var that = this;
				var member_id = uni.getStorageSync("member_id");
				//#ifdef H5
				var ua = navigator.userAgent.toLocaleLowerCase();
				if(ua.match(/MicroMessenger/i) == 'micromessenger')
				{
				   var appid = 'wxb7a354cd32681d5d';
				   uni.setStorageSync("order_id",id);
				   var redirect_uri = encodeURIComponent(that.url+'/order?member_id='+member_id+'&order_id='+id);
				   window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize"+"?appid="+appid+"&redirect_uri="+redirect_uri+"&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
				}
				else
				{
					uni.navigateTo({url:"/pages/mall/order?order_id="+id})
				}
				//#endif
				//#ifdef MP-WEIXIN
				uni.navigateTo({url:"/pages/mall/order?order_id="+id})
				//#endif
				//#ifdef APP-PLUS
				uni.navigateTo({url:"/pages/mall/order?order_id="+id})
				//#endif
			},
			initialize:function(status)
			{
				var that = this;
				var member_id = uni.getStorageSync("member_id");
				// var member_id = 169841;
				var st = parseInt(status);
				// uni.requestSubscribeMessage({
				// 	tmplIds: ['InK-z2h-Nncf9MnmSCvM8PSZsEXDONjTX3cLz4HLseM',//订单支付提醒
				// 			  'mkP9bar4566G3uawjVlaiG4jwukCyQfTl1JPxIR-pKI',//签到提醒
				//               'wG0Vy3NOX8s0PmpyDn4BjPDE37oSe_A7yHUV5aiDeok']//优惠活动通知
				// })
				// var member_id = 169136;
				uni.request({
					url: this.url+'/wechat_get_member_order', 
					data: {member_id:member_id,status:st,start:this.start[status]},
					header: {'Content-Type': 'application/json'},
					success: (res) => {
						if(res.data.status==1)
						{
							that.start[st] += 10;
							for(var k=0;k<res.data.result.length;k++)
							{
								that.result[st].push(res.data.result[k]);
							}
						}
						if(that.refresh_status==1)
						{
							that.refresh_status = 0;
							uni.stopPullDownRefresh();
						}
					}
				});
			},
			delete_submit:function(e)
			{
				var id = e.currentTarget.id;
				var that = this;
				var member_id = uni.getStorageSync("member_id");
				if(this.submit_status==1)
				{
					uni.showModal({
						title:"操作提醒",
						content:"确认要删除该笔订单",
						success:function(res)
						{
							if(res.confirm)
							{
								that.submit_status = 0;
								uni.request({
									url: that.url+'/wechat_delete_order', 
									data: {member_id:member_id,id:id},
									header: {'Content-Type': 'application/json'},
									success: (res) => {
										if(res.data.status==1)
										{
											that.submit_status = 1;
											uni.showToast({
												title:"操作成功",
												duration:2000
											})
											for(var k=0;k<that.result[0].length;k++)
											{
												if(parseInt(id)==that.result[0][k][0].order_id)
												{
													that.result[0].splice(k,1);
												}
											}
										}
									}
								});
							}
						}
					})
					
				}
			},
			detail:function(e)
			{
				var id = e.currentTarget.id;
				uni.navigateTo({
					url:"/pages/news/detail?id="+id
				})
			},
			operation:function(e)
			{
				var id = e.currentTarget.id;
				this.current = parseInt(id);
				this.id = parseInt(id);
				this.initialize(this.id);
			}
		}
	}
</script>


